import {
	defineStore
} from "pinia";

//获取城市
export const getCityName=defineStore('city',{
	state: () => ({
		lable: '东城区',
	}),
	actions:{
		getAddress(name){
			return this.lable=name || this.lable;
		}
	}
})

//计算状态栏的高度
export const useStatusBarStore = defineStore("statusBar", {
	state: () => ({
		height: 0
	}),
	actions: {
		getStatusBarHeight() {
			uni.getSystemInfo({
				success: (res) => {
					this.height= res.statusBarHeight + 40 ;
				}
			});
			return this.height;
		},
	},
	
});

//是否登录/token是否过期
export const useTokenState=defineStore('tokenState',{
	state:()=>({
		token:''
	}),
	actions:{
		getToken(){
			 this.token=uni.getStorageSync('token')?false:true;
			 return this.token;
		},
	}
});